package com.zzyl.controller;

import cn.hutool.json.JSONUtil;
import com.zzyl.base.ResponseResult;
import com.zzyl.constant.Constants;
import com.zzyl.dto.LoginDto;
import com.zzyl.properties.JwtTokenManagerProperties;
import com.zzyl.service.UserService;
import com.zzyl.utils.JwtUtil;
import com.zzyl.vo.UserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;


@Slf4j
@RestController
@RequestMapping("/security")
@RequiredArgsConstructor
@Api(tags = "管理端用户登录")
public class LoginController {

    private final UserService userService;


    /**
     * 管理端用户登录
     * @param loginDto
     * @return
     */
    @PostMapping("/login")
    @ApiOperation(value = "管理端用户登录")
    public ResponseResult<UserVo> login(@ApiParam(value = "登录信息",required = true) @RequestBody LoginDto loginDto){
        UserVo userVo = userService.login(loginDto);
        //返回
        return ResponseResult.success(userVo);
    }

}

